package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.CompoundButton;

public class MainActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public  void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
        switch (buttonView.getId)){
            case R.id.cb_smoke:
                Toast.makeText( SecondActivity.this, " 抽烟被选中", Toast.LENGTH_SHORT).show();
                Toast.makeText( SecondActivity.this, "抽烟未被选中", Toast.LENGTH_SHORT).show();
                break;
            case R.id.cb_drink:
                Toast.makeText( SecondActivity.this, "喝酒", Toast.LENGTH_SHORT).show();
                break;
            case R.id.cb_tangtou:
                Toast.makeText( SecondActivity.this, "烫头", Toast.LENGTH_SHORT).show();
        }
    }
}
